package edu.nf.ch06.service.impl;

import edu.nf.ch06.entity.User;
import edu.nf.ch06.exception.LoginException;
import edu.nf.ch06.service.AuthService;
import org.springframework.stereotype.Service;

/**
 * @author wangl
 * @date 2025/5/13
 */
@Service("authService")
public class AuthServiceImpl implements AuthService {

    @Override
    public User auth(String account, String password) {
        if("wangl".equals(account)) {
            if("123".equals(password)) {
                User user = new User();
                user.setUsername("wangl");
                user.setPassword("123");
                return user;
            }
        }
        throw new LoginException(10001, "账号或密码错误");
    }
}